Skip to content

statedb.go: fix NoTries mode snapshot storage delete#3501

Merged
buddh0 merged 2 commits intobnb-chain:developfrom
zlacfzy:notrie_fix
Dec 24, 2025
Merged

statedb.go: fix NoTries mode snapshot storage delete#3501
buddh0 merged 2 commits intobnb-chain:developfrom
zlacfzy:notrie_fix

Conversation

@zlacfzy
Copy link
Contributor

@zlacfzy zlacfzy commented Dec 24, 2025

Description

In NoTries mode (--tries-verify-mode none), storage data is not properly deleted from the snapshot when handleDestruction is called during SELFDESTRUCT.

Rationale

In NoTries mode, stateObject.updateRoot() always sets Root to EmptyRootHash regardless of actual storage content:

if s.db.db.NoTries() {
    s.data.Root = types.EmptyRootHash
}

This causes two issues in the SELFDESTRUCT flow:

  1. handleDestruction skips storage deletion: The check prev.Root == types.EmptyRootHash incorrectly assumes no storage exists, bypassing deleteStorage().
  2. fastDeleteStorage hash verification fails: Even if deleteStorage is called, the hash check stack.Hash() != root fails because root is EmptyRootHash but the actual storage hash is not.

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

@NathanBSC
Copy link
Contributor

this bug exists more than 2 years, no later than PR https://github.com/bnb-chain/bsc/pull/1840/files

@NathanBSC
Copy link
Contributor

after cancun, with EIP-6780, no wiping out old storages then.
so people download fastnode snapshots and run, this issue will not happen

@buddh0
Copy link
Contributor

buddh0 commented Dec 24, 2025

fix issue #3487

@buddh0 buddh0 merged commit c438d35 into bnb-chain:develop Dec 24, 2025
7 checks passed
@pantaovay pantaovay mentioned this pull request Dec 26, 2025
@allformless allformless added this to the 1.7.0 milestone Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants